home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Apple II Sample Code / MPW IIGS SC / SC.002.BusyBox / busybox.p / uutils.p < prev    next >
Encoding:
Text File  |  1990-06-19  |  1.8 KB  |  98 lines  |  [TEXT/MPS ]

  1. {**********************************************************************
  2. {*
  3. {* BusyBox uUtils -- Version 3.0  (interface)
  4. {*
  5. {* Copyright (c)
  6. {* Apple Computer, Inc.    1986-1989
  7. {* All Rights Reserved.
  8. {*
  9. {* This file contains the interface to the code which implements
  10. {* various utility routines used by the busybox program.
  11. {*
  12. {**********************************************************************}
  13.  
  14. Unit uUtils;
  15.  
  16. INTERFACE
  17.  
  18. USES
  19.     types,
  20.     locator,
  21.     intMath;
  22.  
  23.  
  24. CONST
  25.     srcCopy    =    $0000;
  26.  
  27. FUNCTION IntToString (i : Integer): STR255;
  28. FUNCTION LongToString (l : LongInt): STR255; { test }
  29. FUNCTION IsToolError: BOOLEAN;
  30. PROCEDURE INC(VAR anIndex : Integer);
  31. PROCEDURE Dec(VAR anIndex: Integer);
  32.  
  33. IMPLEMENTATION
  34.  
  35. {$R-}
  36.  
  37. FUNCTION IntToString (i : Integer): STR255;
  38. var
  39.     size,
  40.     count    : Integer;
  41.     num : longInt;
  42.     str : string[20];
  43. BEGIN
  44.     num := i;
  45.     size := 0;
  46.     Long2Dec(num, @str, 19, true);
  47.     FOR count := 1 to 19 DO
  48.     BEGIN
  49.     IF (str[count] = '-') OR ((str[count] >= '0') AND (str[count] <= '9')) THEN
  50.     BEGIN
  51.     size := size + 1;
  52.     IntToString[size] := str[count];
  53.     END;
  54.     END;
  55.     IntToString[0] := char(size);
  56. END;
  57.  
  58. FUNCTION LongToString (l : LongInt): STR255; { test }
  59. var
  60.     size,
  61.     count    : Integer;
  62.     num : longInt;
  63.     str : string[20];
  64. BEGIN
  65.     num := l;
  66.     size := 0;
  67.     Long2Dec(num, @str, 19, true);
  68.     FOR count := 1 to 19 DO
  69.     BEGIN
  70.     IF (str[count] = '-') OR ((str[count] >= '0') AND (str[count] <= '9')) THEN
  71.     BEGIN
  72.     size := size + 1;
  73.     LongToString[size] := str[count];
  74.     END;
  75.     END;
  76.     LongToString[0] := char(size);
  77. END;
  78.  
  79.  
  80. FUNCTION IsToolError: BOOLEAN;
  81. BEGIN
  82.     IsToolError := FALSE;
  83.     if ToolErrorNum <> 0 then
  84.     IsToolError := TRUE;
  85. END;
  86.  
  87. PROCEDURE INC(VAR anIndex : Integer); {increase integer param by 1}
  88. BEGIN
  89.     anIndex := anIndex + 1;
  90. END;
  91.  
  92. PROCEDURE Dec(VAR anIndex: Integer); {decrease integer param by 1}
  93. BEGIN
  94.     anIndex := anIndex - 1;
  95. END;
  96.  
  97. END.
  98.